<template>
	<view>
		<view>
			<qf-image-cropper :src="photoPath" :width="500" :height="500" :radius="30" @crop="handleCrop"></qf-image-cropper>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				photoPath: '',
				type: ''
			};
		},
		onLoad(option) {
			const item = JSON.parse(decodeURIComponent(option.item));
			this.photoPath = item.photoPath
			this.type = item.type
		},
		methods: {
			async handleCrop(e) {
				const uploadRes = await this.$uploadPic(e.tempFilePath)
				console.log(uploadRes)
				let item = {
					_id: 0,
					uploadRes: uploadRes,
					type: this.type
				}
				uni.navigateTo({
					url: '/pages_subpackage/result/result?item=' + encodeURIComponent(JSON.stringify(item))
				})
			}
		}
	}
</script>

<style lang="scss">

</style>